package com.example.resourceSharingPlatform.security_service.impl;

import com.example.resourceSharingPlatform.security_dao.UsersDao;
import com.example.resourceSharingPlatform.security_entity.Users;
import com.example.resourceSharingPlatform.security_service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * UserService实体类
 * selectUserByUserName(String userName)
 * 通过用户名在数据库查询用户信息
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UsersDao usersDao;

    @Override
    public Users selectUserByUserName(String userName) {
        //Users user = new Users();
        //user.setUserName(userName);
        List<Users> list = usersDao.queryUsersByUserName(userName);
        return list.isEmpty() ? null : list.get(0);
    }
}
